package tw.com.jinwei;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import org.apache.log4j.Logger;
import org.jdesktop.swingx.JXLoginPane;

import tw.com.jinwei.utils.ContextUtils;
import tw.com.jinwei.utils.LogHelper;

public class Main {

	private static Logger log = LogHelper.getLog(Main.class);

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{
		if (log.isDebugEnabled()) {
			log.debug(new StringBuilder("start main function"));
		}

//		SwingUtilities.invokeLater(new Runnable() {
//
//			public void run() {
//				try {
//					// Set cross-platform Java L&F (also called "Metal")
//					UIManager
//							.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel");
//				} catch (UnsupportedLookAndFeelException e) {
//					// handle exception
//				} catch (ClassNotFoundException e) {
//					// handle exception
//				} catch (InstantiationException e) {
//					// handle exception
//				} catch (IllegalAccessException e) {
//					// handle exception
//				}
//
//				JXLoginPane pane = (JXLoginPane) ContextUtils.getContext()
//						.getBean("loginPane");
//
//				JFrame frame = JXLoginPane.showLoginFrame(pane);
//				frame.setVisible(true);
//			}
//		});

		System.setProperty("Quaqua.tabLayoutPolicy", "wrap");
		// set the Quaqua Look and Feel in the UIManager
		try {
			UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager
					.getLookAndFeel());
			// set UI manager properties here that affect Quaqua
		} catch (Exception e) {
			// take an appropriate action here
		}
		JXLoginPane pane = (JXLoginPane) ContextUtils.getContext().getBean(
				"loginPane");
		JFrame frame = JXLoginPane.showLoginFrame(pane);
		frame.setVisible(true);

	}
}
